package com.ctrl.riveradministrator.mvp.view.activity.channel_segment;

import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Message;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseActivity;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.ChannelSeg;

public class ChannelSegDetailActivity extends BaseActivity {

    private Toolbar toolbar;
    private TextView titleTv;
    private ImageView leftMenu;

    private ChannelSeg channelSeg;
    private TextView name, hdszdqy, hdszhl, hgy, fzhz, fzjz, qdxzqh, qdwz, jdwz, ab, kjcd;

    @Override
    protected void initParams(Bundle parms) {
        channelSeg = (ChannelSeg) getIntent().getSerializableExtra("river_seg");
    }

    @Override
    protected int bindLayout() {
        return R.layout.activity_channel_seg_detail;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void initView(View view) {
        toolbar = (Toolbar) $(R.id.toolbar);
        titleTv = (TextView) $(R.id.title_tv);
        leftMenu = (ImageView) $(R.id.left_iv);
        name = (TextView) $(R.id.name);
        hdszdqy = (TextView) $(R.id.hdszdly);
        hdszhl = (TextView) $(R.id.hdszhl);
        hgy = (TextView) $(R.id.hgy);
        fzhz = (TextView) $(R.id.fzhz);
        fzjz = (TextView) $(R.id.fzjz);
        qdxzqh = (TextView) $(R.id.qdxzqh);
        qdwz = (TextView) $(R.id.qdwz);
        jdwz = (TextView) $(R.id.jdwz);
        ab = (TextView) $(R.id.ab);
        kjcd = (TextView) $(R.id.kjcd);

        /*
         * 设置toolbar
         * */
        toolbar.setTitleTextColor(Color.WHITE);
        toolbar.setTitle("");
        titleTv.setText(channelSeg.getReachName() + "详细信息");
        leftMenu.setBackground(getDrawable(R.drawable.ic_chevron_left_24dp));
    }

    @Override
    protected void doBusiness(Context mContext) {
        name.setText(channelSeg.getReachName());
        hdszdqy.setText(channelSeg.getReachAreaName());
        hdszhl.setText(channelSeg.getRiverName());
        hgy.setText(channelSeg.getRiverKepper());
        fzhz.setText(channelSeg.getResponsibleHezhangId());
        fzjz.setText(channelSeg.getResponsibleSheriffId());
        qdxzqh.setText(channelSeg.getStartAreaName());
        qdwz.setText(channelSeg.getStartPlace());
        jdwz.setText(channelSeg.getTranAttributeName());
        ab.setText(channelSeg.getShoreSeparationName());
        kjcd.setText(channelSeg.getReachLength());
    }

    @Override
    protected void widgetClick(View view) {
        switch (view.getId()) {
            case R.id.left_iv:
                finish();
                break;
        }
    }

    @Override
    protected void setListener() {
        leftMenu.setOnClickListener(this);
    }

    @Override
    public void handleMessage(Message message, int what) {

    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }
}
